package com.youchuang.controller;

import com.youchuang.service.HelloWorldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class WebController {

    @Value("${server.port}")
    String port;

    @Value("${hello}")
    String hello;

    @Autowired
    HelloWorldService helloWorldFeignService;


    @RequestMapping(value = "/hello", method = RequestMethod.GET)
    public String sayHello() {
        return helloWorldFeignService.sayHello();
    }

    @RequestMapping(value = "/port")
    public String port() {
        return "this application port is " + port;
    }


    @RequestMapping(value = "/gitHello")
    public String gitHello() {
        return hello;
    }

}